<?php

namespace app\webapp\controller;

use app\common\controller\Frontend;
use app\webapp\library\Auth;
use app\common\library\Alipayopen\request;
/**
 * 公共控制器
 */
class Common extends Frontend
{
    protected $noNeedLogin = ['login', 'logout','register'];
    protected $auth = '';

    public function _initialize()
    {
        $this->auth = Auth::instance();
        parent::_initialize();

        //验证是否登陆
        $this->auth = new Auth();


/*        $ali_request = new request\AlipayUserInfoShareRequest();
        echo "<pre>";
        print_r($ali_request->getApiMethodName());
        echo "</pre>";
        exit;*/
        //验证登陆
        if(!$this->user->isLogin()){
            $agent = alipay_or_weixin();
            if($agent){

                echo  $this->view->fetch('user/'.$agent.'login');exit;
            }else{
                echo  $this->view->fetch('user/login');exit;
            }
        }
    }



}
